package kola.controls
{
	import flash.events.MouseEvent;
	
	import kola.events.CheckListEvent;
	import kola.renderers.CheckListRenderer;
	
	import mx.controls.Tree;
	import mx.core.ClassFactory;
	
	
	public class CheckList extends Tree
	{
		public function CheckList()
		{
			super();
			allowMultipleSelection = true;
			itemRenderer = new ClassFactory(CheckListRenderer);
			addEventListener(CheckListEvent.ITEM_CHECKED, onItemChecking);
			addEventListener(CheckListEvent.ITEM_UNCHECKED, onItemChecking);
		
		}
		
		protected function onItemChecking(event:CheckListEvent):void
		{
			//select item
			selectItem(event.item, false,true);

		}
		
		override public function set selectedItems(items:Array):void
		{
			super.selectedItems = items;
		}
		
		override protected function mouseDownHandler(event:MouseEvent):void
		{
			//prevent default
		}
		
		override protected function mouseUpHandler(event:MouseEvent):void
		{
			//prevent default
		}
		
		
		
		
	}
}